package com.crape.topic.dao.impl;

import java.util.HashMap;
import java.util.Map;

import com.crape.common.exceptions.DAOException;
import com.crape.common.ibatis.SqlMapClientDaoSupportEx;
import com.crape.topic.dao.ISubjectVisitorDAO;

public class SubjectVisitorDAOImpl extends SqlMapClientDaoSupportEx implements ISubjectVisitorDAO {

	@Override
	public Long countSubjectVisitor(Long visitorid, Long subjectid) throws DAOException {
		if (visitorid == null || subjectid == null) {
			return 0L;
		}
		Map<String, Long> params = new HashMap<String, Long>();
		params.put("visitorid", visitorid);
		params.put("subjectid", subjectid);
		return (Long) this.queryObject("countSubjectVisitor", params);
	}

	@Override
	public void insertSubjectVisitor(Long visitorid, Long subjectid) throws DAOException {
		if (visitorid == null || subjectid == null) {
			return;
		}
		Map<String, Long> params = new HashMap<String, Long>();
		params.put("visitorid", visitorid);
		params.put("subjectid", subjectid);
		this.insert("insertSubjectVisitor", params);
	}

	@Override
	public void updateSubjectVisitor(Long visitorid, Long subjectid) throws DAOException {
		if (visitorid == null || subjectid == null) {
			return;
		}
		Map<String, Long> params = new HashMap<String, Long>();
		params.put("visitorid", visitorid);
		params.put("subjectid", subjectid);
		this.update("updateSubjectVisitor", params);
	}

}
